<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>修改试题</title>
<%@include file="../core/head.jsp"%>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" href="${ctx }/css/core.css" type="text/css"></link>
<link rel="stylesheet" href="${ctx }/css/exam.css" type="text/css"></link>
<link rel="stylesheet" href="${ctx }/css/buttons.css" type="text/css"></link>

<style type="text/css">

#upload .title textarea {
	width: 90%;
	height: 80px;
	padding: 2px;
	border: 1px solid #f2f2f2;
}

#upload .option {
	padding-left: 10px;
}

#upload .option input[type='text'] {
	width: 88%;
	height: 26px;
	line-height: 24px;
	padding: 2px;
	border-left: 0px;
	border-right: 0px;
	border-top: 0px;
	border-bottom: 1px solid #f2f2f2;
}

#addNew {
	width: 100px;
	height: 26px;
	font-size: 14px;
}

#upload .no {
	vertical-align: top;
	margin: 0px;
	padding: 0px;
}

#upload .help {
	display: block;
	background: #f2f2f2;
}

#upload .analysis {
	width: 100%;
	height: 80px;
	padding: 2px;
	border: 1px solid #f2f2f2;
}
#templete{
	display: none;
}
</style>
 <script type="text/javascript">
	
	function answer(ques, zhis, langu) {
		zhis.value = zhis.checked;
		var checkbox = $("#" + ques + " ." + langu + " :checkbox[title='"+ zhis.title + "']");
		checkbox.each(function() {
			this.checked = zhis.checked;
			this.value = zhis.checked;
		});
		var answ = undefined;
		$("#" + ques + " ." + langu + " :checked").each(function() {
			if (answ == undefined) {
				answ = "";
			} else {
				answ = answ + ",";
			}
			answ = answ + this.title;
		});
		var hiput = $("#answer" + ques).val(answ);
		 
	}
	
	
	$(function(){
		if(allnum==0){
			addNewQuestion();
		}
	});
</script>
</head>

<body style="background: #f2f2f2;">
<%@include file="top.jsp"%>
 <div id="upload" class="width center shadow radius paper" >
		<div id="context" class="context" >			
			<form action="${ctx}/exam/updateQuestion.action"   id="form${tem.index}" method="post" >
			<input type="hidden"  name="question.no" value="${question.no }"/>
				<input type="hidden"  name="question.ptype" value="${question.ptype }"/>
				<input type="hidden"  name="question.id" value="${question.id }"/>
				<div class="question" id="${tem.index+1}" style="border: 0px;">
				<label>[ 试题编号：${question.no }&nbsp;&nbsp;&nbsp;&nbsp;章节：<z:dic code="${question.chapter }"/> ]</label>
					<ul>
						<li class="english">
						<dl>
							<dt class="title">
								<span class="no">${tem.index+1}.</span> 
								<textarea name="question.enSummary"><c:out value="${question.enSummary }"/></textarea>
							</dt> 
							<c:forEach var="opt" varStatus="otem" items="${question.options }">
								<dd class="option">	 							 
										<input type="checkbox" title="${opt.no}" 
										onclick="answer('${tem.index+1}',this,'chinese')"
										<c:if test="${ opt.correct }">checked="checked"</c:if> />						 
										<span>${opt.no}.&nbsp;</span>
										<input type="text" name="question.options[${otem.index}].enSummary" value="<c:out value='${opt.enSummary }'/>"/>
								</dd>
							</c:forEach>
						</dl>
						</li>
						<li class="chinese">
						<dl>
							<dt class="title">
								<span class="no">${tem.index+1}.</span>
								<textarea name="question.cnSummary"><c:out value="${question.cnSummary }"/></textarea>
							</dt> 
							<c:forEach var="opt" varStatus="otem" items="${question.options }">
								<dd class="option">
									<input 
									type="checkbox" 
									title="${opt.no}" 
									name="question.options[${otem.index}].correct" 
									value="${opt.correct}" 
									<c:if test="${ opt.correct }">checked="checked"</c:if> 
									onclick="answer('${tem.index+1}',this,'english');"/>									
									
									<span>${opt.no }.&nbsp;</span>
									<input type="hidden" name="question.options[${otem.index}].id" value="<c:out value='${opt.id }'/>"/>
 									<input type="hidden" name="question.options[${otem.index}].no" value="<c:out value='${opt.no }'/>"/>
									<input type="text" name="question.options[${otem.index}].cnSummary" value="<c:out value='${opt.cnSummary }'/>"/>
								</dd>
							</c:forEach>
						</dl>
						</li>
					</ul>
					<div align="right">
						<div class="help radius" align="left">
							<div class="left">
								<label>答案：<input type="text" id="answer${tem.index+1}" name="question.answer" value="${question.answer }" style="width: 80px;text-align: center;" readonly="readonly"/></label> 
							</div>
							<div  class="right">
							<!-- 
								<input type="text"  name="question.tags" style="width: 400px;"/></label>
							 -->
							 <label>章节：
								 <select name="question.chapter" style="width: 200px;">
									 <z:dic code="${question.ptype}" isType="true"/>
								 </select>
							 </label>
							  
							</div>
							<div class="clear">
								<textarea name="question.analysis" class="analysis" >${question.analysis }</textarea>
							</div>
						</div>
						<input class="button gray small" type="button" onclick="history.back()" value="取消" />
						<input class="button green small" type="submit" value="修正" />
					</div>
				</div>
				</form>
	</div>
	
	
</div>	
	
	
<%@include file="../core/bottom.jsp"%>
</body>
</html>
